﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VirtualPress.Infrastructure.Entities.Repository;
using VirtualPress.Infrastructure.Entities.Enum;

namespace VirtualPress.Infrastructure.Entities.Entity
{
    public class ExpertInvite : IAccessible<Invite, ExpertInvite>, ILogicEntity<Invite, ExpertInvite>
    {
        #region Fileds
        public int Id { get; set; }
        public int journalId { get; set; }
        public string SendFrom { get; set; }
        public string SendTo { get; set; }
        public InviteStatus Status { get; set; }
        public string Message { get; set; }
        public DateTime CreateTime { get; set; }
        #endregion

        protected override void Covariant(Invite model)
        {
            if (model != null)
            {
                this.Id = model.Id;
                this.journalId = model.journalId;
                this.SendFrom = model.SendFrom;
                this.SendTo = model.SendTo;
                this.Status = (InviteStatus)model.Status;
                this.Message = model.Message;
                this.CreateTime = model.CreateTime;
            }
        }

        protected override Invite Inverter(ExpertInvite model)
        {
            if (model != null)
            {
                return new Invite()
                {
                    CreateTime = model.CreateTime,
                    Id = model.Id,
                    journalId = model.journalId,
                    Message = model.Message,
                    SendFrom = model.SendFrom,
                    SendTo = model.SendTo,
                    Status = (int)model.Status
                };
            }
            return null;
        }

        public ExpertInvite Set(Invite dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
